
import React,{useState,useLayoutEffect,useRef, useEffect} from "react";

// useLayoutEffect 钩子在rendder后同步执行，在重绘之前，可以防止渲染闪烁
class App extends React.Component {
    constructor (props) {
        super() // 不传props的话，在构造器里this.props是undefind， render中一直有值
    }
    render () {
        return (
            <div>App</div>
        )
    }
}


function withRenderHijacking(WrappedComponent) {
    return class extends WrappedComponent {
        constructor(props) {
            super(props);
            this.state = {
            };
        }
        render() {

            return (
                <div>
                    渲染劫持header
                    {super.render()}
                </div>
            )
        }
    };
}

export default withRenderHijacking(App)